package cn.edu.lingnan.service;

import cn.edu.lingnan.dao.CompetitionDao;
import cn.edu.lingnan.dao.ICompetitionDao;
import cn.edu.lingnan.pojo.Competition;

import java.util.List;

public class ICompetitionService implements CompetitionService{
    CompetitionDao competitionDao = new ICompetitionDao();
    @Override
    public List<Competition> findCompetitionByName(String name) {
        return competitionDao.findCompetitionByName(name);
    }

    @Override
    public List<Competition> findCompetitionAll() {
        return competitionDao.findCompetitionAll();
    }

    @Override
    public boolean addCompetition(Competition competition) {
        int flag= competitionDao.addCompetition(competition);
        if(flag==1){
            return true;
        }else {
            return false;
        }
    }

    @Override
    public boolean delCompetitionByName(String name) {
        int flag= competitionDao.delCompetitionByName(name);
        if(flag==1){
            return true;
        }else {
            return false;
        }
    }

    @Override
    public boolean delCompetitionById(int id) {
        int flag = competitionDao.delCompetitionById(id);
        if(flag==1){
            return true;
        }else {
            return false;
        }
    }

    @Override
    public boolean updateCompetitionById(Competition competition) {
        int flag= competitionDao.updateCompetitionById(competition);
        if(flag==1){
            return true;
        }else {
            return false;
        }
    }

    @Override
    public boolean isCompeteRegPart(int competitionId) {
        return competitionDao.isCompeteRegPart(competitionId);
    }

    @Override
    public List<String> projectList() {
        return competitionDao.projectList();
    }
}
